package com.bayair.doctor.ui;

import com.bayair.common.BaseDialog;
import com.bayair.doctor.R;
import com.bayair.doctor.base.component.BaseFragment;
import com.bayair.doctor.widget.dialog.MenuDialog;

import androidx.core.content.ContextCompat;
import butterknife.OnClick;

//测试
public class TestFragment extends BaseFragment {

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_test;
    }

    @OnClick(R.id.show)
    void show() {
        new MenuDialog.Builder(getAttachActivity())
                .setCancelable(false)
                //.setAutoDismiss(false) // 设置点击按钮后不关闭对话框
                .setList("加载中", "请求错误", "空数据提示", "自定义提示")
                .setListener(new MenuDialog.OnListener() {

                    @Override
                    public void onSelected(BaseDialog dialog, int position, Object object) {
                        switch (position) {
                            case 0:
                                showLoading();
                                getView().postDelayed(new Runnable() {
                                    @Override
                                    public void run() {
                                        showComplete();
                                        showEmpty();
                                    }
                                }, 2000);
                                break;
                            case 1:
                                showError();
                                break;
                            case 2:
                                showEmpty();
                                break;
                            case 3:
                                showLayout(ContextCompat.getDrawable(getActivity(), R.drawable.icon_hint_address), "还没有添加地址");
                                break;
                            default:
                                break;
                        }
                    }

                    @Override
                    public void onCancel(BaseDialog dialog) {}
                })
                .show();
    }



    @Override
    protected void initData() {

    }
}
